<template>
  <div class="test">
    <van-nav-bar title="意见反馈" left-arrow fixed placeholder />
    <p>原生方法调试</p>
    <van-button @click="fun1">getUserInfo </van-button>
    <van-button @click="fun2">closeWebView </van-button>
    <van-button @click="fun3">navigateBackTo </van-button>
    <van-button @click="fun4">setNavigationBarVisible </van-button>
    <van-button @click="fun5">getLocation </van-button>
    <van-button @click="fun6">phoneFunc </van-button>
    <p>info: {{ info }}</p>
  </div>
</template>
<script lang="ts" setup>
import bridge from '@/utils/bridge.js'
const info = ref('')
const fun1 = async () => {
  const res = await bridge.getUserInfo()
  console.log(res)
  info.value = res
}
const fun2 = () => {
  bridge.closeWebView()
}
const fun3 = () => {
  bridge.navigateBackTo({
    value: 'login',
    a: '1',
    b: '2'
  })
}
const fun4 = () => {
  bridge.setNavigationBarVisible({
    value: '0'
  })
}
const fun5 = async () => {
  const res = await bridge.getLocation()
  console.log(res)
  info.value = res
}
const fun6 = () => {
  bridge.phoneFunc({
    value: '15600000000'
  })
}
</script>
<style lang="scss" scoped>
.test {
  padding: 20px;
  .label {
    margin-right: 10px;
    font-size: 16px;
  }
}
.flex {
  display: flex;
  align-items: center;
}
</style>
